package com.sbtr.controller.feature;

import com.sbtr.business.feature.dto.FeStandardRuleDto;
import com.sbtr.business.feature.entity.FeStandardRule;
import com.sbtr.business.feature.service.FeStandardRuleService;
import com.sbtr.common.PageDto;
import com.sbtr.common.Response;
import com.sbtr.controller.common.CommonController;
import com.sbtr.exception.BDException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * 数据标准化字段列表 前端控制器
 *
 * @author dgl
 * @since 2023-04-21
 */
@RestController
@RequestMapping("/feStandardRule")
@Api(tags = "数据标准化字段列表")
public class FeStandardRuleController extends CommonController<FeStandardRule,FeStandardRuleService> {

    @GetMapping("/pageList")
    @ApiOperation(httpMethod = "GET", value = "分页列表")
    public Response<PageDto<FeStandardRule>> pageList(FeStandardRuleDto feStandardRuleDto){
        return Response.success(u.pageList(feStandardRuleDto));
    }

    @PostMapping("/save")
    @ApiOperation(httpMethod = "POST", value = "保存")
    public Response<FeStandardRule> save(@RequestBody FeStandardRule feStandardRule){
        feStandardRule.setId(null);
        if(feStandardRule.insert()){
            return Response.success(feStandardRule);
        }else throw new BDException("保存失败");
    }

}

